<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>06-动态生成表格.html</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <style type="text/css">
    	table{
    		border: 1px red solid;
    		width: 300px;
    		border-collapse:collapse;
    	}
    	td{
    		border:1px blue solid;
    		margin: 0px;
    		padding: 0px;
    		
    	}
    </style>
    <script type="text/javascript">
        window.onload = ()=>{
            function deme(){
                let table = document.createElement("table");
                let tr = document.createElement("tr");
                let td = document.createElement("td");
                let row = document.getElementById("row").value;
                let col = document.getElementById("col").value;
                for (let i= 0;i< col ;i++){
                    td.innerText= "test";
                    tr.appendChild(td);


                }
                for (let i = 0; i < row; i++) {
                    table.appendChild(tr)
                }
            }
        }
    
    </script>
  </head>
  
  <body>
  	<div id="one" >
  		 
  	</div>
  	输入行：<input type="text" id="row"/><br />
  	输入列：<input type="text" id="col"/><br />
  	<input type="button" value="创建表格" onclick="demo()"/>
  </body>
</html>
